package culton.android.smstracker;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class CultonSMSTracker extends Activity {
 
	private Button serviceTest;
	private EditText phone;
	private EditText message;
		
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        phone = (EditText) findViewById(R.id.phoneNumber);
        message = (EditText) findViewById(R.id.textMessage);
        
        serviceTest = (Button) findViewById(R.id.serviceButton);        
        serviceTest.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {            	
            	String phoneNumber = phone.getText().toString();
            	String messageText = message.getText().toString();;
            	
                if (phone.length()>0 && message.length()>0)                
                    SMSHandler.sendSMS(CultonSMSTracker.this, phoneNumber, messageText);                
                else
                	Toast.makeText(getBaseContext(), 
                        "Please enter both phone number and message.", 
                        Toast.LENGTH_SHORT).show();
            }
        });
    }    
}